package MultiMediaPlayer.Media.decorator;

import MultiMediaPlayer.Media.Media;


//装饰模式
public class SpeedDecorator extends MediaDecorator {
    private final Media media;
    private final double speed;

    public SpeedDecorator(Media media, double speed) {
        this.media = media;
        this.speed = speed;
    }

    @Override
    public String getDescription() {
        return media.getDescription() + "\n"
                 + "-->" + speed + "倍速";
    }

    @Override
    public void play() {
        media.play();
        System.out.println("正在以x" + speed + "倍速播放...");
    }

    @Override
    public String getName() {
        return media.getName();
    }
}
